#include "ThresholdDialog.h"
#include "MainFrame.h"

ThresholdDialog::ThresholdDialog( wxWindow* parent )
:
ThresholdDialogTemplate( parent )
{

	

}

void ThresholdDialog::OnLUHScroll( wxScrollEvent& event )
{
	int h = sliderLUH->GetValue();
	int s = sliderLUS->GetValue();
	int v = sliderLUV->GetValue();
	
	MainFrame* parent = (MainFrame*)this->GetParent();
	parent->changeColorLUmbral(cvScalar(h,s,v));
	
}

void ThresholdDialog::OnLUSScroll( wxScrollEvent& event )
{
	int h = sliderLUH->GetValue();
	int s = sliderLUS->GetValue();
	int v = sliderLUV->GetValue();
	
	MainFrame* parent = (MainFrame*)this->GetParent();
	parent->changeColorLUmbral(cvScalar(h,s,v));
}

void ThresholdDialog::OnLUVScroll( wxScrollEvent& event )
{
	int h = sliderLUH->GetValue();
	int s = sliderLUS->GetValue();
	int v = sliderLUV->GetValue();
	
	MainFrame* parent = (MainFrame*)this->GetParent();
	parent->changeColorLUmbral(cvScalar(h,s,v));
}

void ThresholdDialog::OnHUHScroll( wxScrollEvent& event )
{
	int h = sliderHUH->GetValue();
	int s = sliderHUS->GetValue();
	int v = sliderHUV->GetValue();
	
	MainFrame* parent = (MainFrame*)this->GetParent();
	parent->changeColorHUmbral(cvScalar(h,s,v));
}

void ThresholdDialog::OnHUSScroll( wxScrollEvent& event )
{
	int h = sliderHUH->GetValue();
	int s = sliderHUS->GetValue();
	int v = sliderHUV->GetValue();
	
	MainFrame* parent = (MainFrame*)this->GetParent();
	parent->changeColorHUmbral(cvScalar(h,s,v));
}

void ThresholdDialog::OnHUVScroll( wxScrollEvent& event )
{
	int h = sliderHUH->GetValue();
	int s = sliderHUS->GetValue();
	int v = sliderHUV->GetValue();
	
	MainFrame* parent = (MainFrame*)this->GetParent();
	parent->changeColorHUmbral(cvScalar(h,s,v));
}

void ThresholdDialog::updateValues()
{
	MainFrame* parent1 = (MainFrame*)this->GetParent();
	CvScalar low = parent1->getColorLUmbral();
	
	sliderLUH->SetValue((int)low.val[0]);
	sliderLUS->SetValue((int)low.val[1]);
	sliderLUV->SetValue((int)low.val[2]);
	
	CvScalar high = parent1->getColorHUmbral();
	
	sliderHUH->SetValue((int)high.val[0]);
	sliderHUS->SetValue((int)high.val[1]);
	sliderHUV->SetValue((int)high.val[2]);
}

